-
Notifications
You must be signed in to change notification settings - Fork 4.3k
chore(cli): generate conversion from cdk.json to cli arguments #32803
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #32803 +/- ##
=======================================
Coverage 81.52% 81.52%
=======================================
Files 222 222
Lines 13717 13717
Branches 2417 2417
=======================================
Hits 11183 11183
Misses 2254 2254
Partials 280 280
Flags with carried forward coverage won't be shown. Click here to find out more.
|
| * The CLI command name | ||
| */ | ||
| readonly _: Command; | ||
| readonly _?: Command; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needed because cdk.json doesn't have a specific command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just make it two different interface then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that's necessary. CliArguments does/should not do any enforcing. Enforcement comes from sending our CLI input through yargs. Therefore, I think it makes sense that every option on CliArguments is optional. It's just a schema for config options.
Arguably, CliArguments is now a misnomer because it governs both CLI options and cdk.json options. But the goal is to make sure those two are one and the same anyway.
Would it alleviate your concerns if I renamed CliArguments into Arguments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's not CLI anymore, there's no reason to call it _. We only do that because of yargs.
I think we are turning it into structured user input, so maybe something along the lines of UserInput?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will rename CliArguments to UserInput, and rename _ to command in a separate PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
| const cliArguments: CliArguments = { | ||
| globalOptions, | ||
| list: listOptions, | ||
| synthesize: synthesizeOptions, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should synth be the main name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that can be done but that would have to be a change to config.ts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the impact here? When are we committing to a specific action name in cdk.json? I think we need to make that call before we are committing to it. WDYT about synth vs synthesize though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i will create a separate PR that changes the default name of synthesize to synth. I believe we've standardized on that, and up until now yargs allows them to work interchangably. Existing configurations should not change, and then we will allow synth as the keyword in cdk.json to provide default configs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor feedback.
Co-authored-by: Momo Kornher <[email protected]>
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
|
Comments on closed issues and PRs are hard for our team to see. |
This PR does not change the functionality of the CLI (yet)
It does however articulate a schema for what
cdk.jsonshould look like in the future. I'm aware that we honor a slightly different set of rules incdk.jsonthat is not documented anywhere, and we will have to honor those rules ad-hoc. However, this will hopefully move us towards a strongly-typed future wherecdk.jsoncontents mirror CLI argument options.cdk.jsonCliArguments.{ "app": "npx ts-node -P tsconfig.json --prefer-ts-exts src/main.ts", "output": "cdk.out", "build": "npx projen bundle", "watch": { "exclude": [ "README.md", "cdk*.json", "**/*.d.ts", "**/*.js", "tsconfig.json", "package*.json", "yarn.lock", "node_modules" ] }This will turn into the following
CliArgumentobject:By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license